import { request } from "../../utils/http";
import { Departments, HospitalScheduleResponse, HospitalShow, provinceItems, ReqHospitalListParams, ReqHospitalListResponse, reqScheduleDetailParams, reqSetHospitalScheduleParams, ScheduleRuleResponse } from "./model/hospitalListTypes";

export function reqGetHospitalList({page,limit,...args}:ReqHospitalListParams){
    return request.get<any,ReqHospitalListResponse>(`/admin/hosp/hospital/${page}/${limit}`,
    {
        params:args,
    }
    )
}
//省份获取请求的封装
export function reqGetProvinces(){
    return request.get<any,provinceItems>('/admin/cmn/dict/findByDictCode/province')
}

//市或者区的请求封装

export function reqGetCitiesOrDistrict(parentId:number){
    return request.get<any,provinceItems>(`/admin/cmn/dict/findByParentId/${parentId}`)
}

export function reqGetHospitalType(){
    return request.get<any,provinceItems>(`/admin/cmn/dict/findByParentId/10000`)
}

export function reqGetHospitalShow(id:string){
    return request.get<any,HospitalShow>(`/admin/hosp/hospital/show/${id}`);
}

//获取科室信息
export function reqGetDepartment(hoscode:string){
    return request.get<any,Departments>(`/admin/hosp/department/${hoscode}`)
}

//获取排班信息
export const getSchedule=({page,limit,hoscode,depcode}:reqSetHospitalScheduleParams)=>{
    return request.get<any,ScheduleRuleResponse>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
  }
//详细某一天的排班

export const getScheduleOneday=({hoscode,depcode,workDate}:reqScheduleDetailParams)=>{
   return request.get<any,HospitalScheduleResponse>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}